import 'package:enterprise_v6_app/app/core/http/http.dart';
import 'package:enterprise_v6_app/app/core/utils/interface.dart';
import 'package:enterprise_v6_app/app/data/entities/double_control/get_task_record_by_unit_id_entity.dart';
import 'package:get/get.dart';

///排查计划详情详情
class InvestigationPlanLedgerDetailDetailController extends GetxController {
  List<GetTaskRecordByUnitIdEntity> entityList = [];
  String riskUnitName = '';
  String planId = '';
  String unitId = '';

  @override
  void onInit() {
    super.onInit();
    planId = Get.arguments['planId'] as String;
    unitId = Get.arguments['unitId'] as String;
    riskUnitName = Get.arguments['riskUnitName'] as String; //单元
    //点击单元查询任务详情列表
    _getTaskRecordByUnitId();
  }

  void _getTaskRecordByUnitId() async {
    final res = await HttpUtil().generateGetRequest<List<GetTaskRecordByUnitIdEntity>>(
      Interface.getTaskRecordByUnitId,
      queryParameters: {
        'planId': planId,
        'unitId': unitId,
      },
    ).execute();
    res.onSuccess((result) {
      if (result.data != null) {
        entityList = result.data!;
      }
    });
    update();
  }
}
